package com.sky.financelake.viewmodels.remote;

import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;

import com.sky.financelake.bean.dto.SimpleStockDto;
import com.sky.financelake.bean.dto.StockDto;
import com.sky.financelake.bean.entity.Fundamental;
import com.sky.financelake.bean.param.StockParam;
import com.sky.financelake.retrofit.ApiResponse;
import com.sky.financelake.retrofit.FundamentalRepository;
import com.sky.financelake.viewmodels.BaseViewModel;

import java.util.List;

public class FundamentalViewModel extends BaseViewModel {
    private MutableLiveData<ApiResponse<Fundamental>> liveData;
    private FundamentalRepository repository;

    public FundamentalViewModel() {
        if (liveData != null) {
            return;
        }
        repository = FundamentalRepository.getInstance();
    }

    public FundamentalRepository getRepository() {
        return repository;
    }

    public LiveData<ApiResponse<Fundamental>> getFundamentalLiveData() {
        if (liveData == null) {
            liveData = new MutableLiveData<ApiResponse<Fundamental>>();
        }
        return liveData;
    }


    public void getFundamentalByCode(String code) {
        repository.getFundamentalByCode(liveData, code);
    }
}
